/**
 * 
 */
package datamodel.tree;

import datamodel.rucksack.Rucksack;

/**
 * An abstract class for a tree node. Holds the rucksack
 * 
 * @author Kevin Munk, Jakob Karolus
 * @version 1.0
 *
 */
public abstract class TreeNode {
	
	private Rucksack rucksack = null;
	
	/**
	 * constructor
	 * @param rucksack the rucksack for this node
	 */
	public TreeNode(Rucksack rucksack){
		this.rucksack = rucksack;
		}

	/**
	 * @return the weight of the rucksack in this node
	 */
	public int getWeight() {
		return rucksack.getWeight();	
		}

	/**
	 * 
	 * @return the values of the rucksack in this node
	 */
	public int getValue() {
		return rucksack.getValue();
	}

	/**
	 * 
	 * @return the rucksack of this node
	 */
	public Rucksack getRucksack() {
		return rucksack;	}
	
	@Override
	public boolean equals(Object object) {
		if(!(object instanceof TreeNode))
			return false;
		
		return this.rucksack.equals(((TreeNode)object).getRucksack());
	}
	
}
